import request from '@/utils/request'
// const baseURL = process.env.VUE_APP_BASE_API

// 附件上传
export function fileUpload(data) {
  return request({
    url: '/file/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
// 注册和个人/企业新增证书识别接口
export function fileUploadCert(data, certId) {
  return request({
    url: '/supervise/certificateTemplateApi/upload/' + certId,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
export function fileUploadFirst(id) {
  return request({
    url: '/file/downloadByPhone/',
    params: id,
    responseType: 'arraybuffer'
  })
}

// export function fileCertUpload(data) {
//   return request({
//     url: '/sys/sysAccountApi/upload',
//     method: 'post',
//     data,
//     headers: {
//       'Content-Type': 'multipart/form-data'
//     }
//   })
// }

// 图片回显
export function imgDownLoad(id) {
  return request({
    url: '/file/download',
    method: 'post',
    params: id,
    responseType: 'arraybuffer'
  })
}

// 附件下载
export function fileDownLoad(id) {
  const data = { id: id }
  return request({
    url: '/file/download',
    method: 'post',
    params: data,
    responseType: 'arraybuffer'
  })
}

// 附件删除
export function fileDelete(id) {
  return request({
    url: '/file/deleteIds/',
    method: 'post',
    params: id
  })
}

// 测试
export function fileDownLoadTest(id) {
  const data = { explorationId: id }
  return request({
    url: '/supervise/explorationApi/downLoadSignatureFile',
    method: 'post',
    params: data,
    responseType: 'arraybuffer'
  })
}
